package com.entity;

/**
 * 分页对应的实体类
 */
public class Page {
	//总条数
	private long totalNumber;
	//当前第几页
	private int currentPage;
	//总页数
	private int totalPage;
	//每页显示几条
	private int pageNumber = 5;

	public void count() {
		// 计算总页数
		int totalPageTemp = (int)this.totalNumber / this.pageNumber;
		int plus = (this.totalNumber % this.pageNumber) == 0 ? 0 : 1;
		totalPageTemp = totalPageTemp + plus;
		if(totalPageTemp <= 0) {
			totalPageTemp = 1;
		}
		this.totalPage = totalPageTemp;
	}

	public long getTotalNumber() {
		return totalNumber;
	}

	public void setTotalNumber(long totalNumber) {this.totalNumber = totalNumber;}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public int getPageNumber() {return pageNumber;}

	public void setPageNumber(int pageNumber) {this.pageNumber = pageNumber;}

}
